package com.shuqi.download.database;

import java.io.Serializable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * 文件下载信息
 * @author GaoPeng<gaopeng@ucweb.com>
 *
 */
@DatabaseTable(tableName = "download_info")
//@DatabaseTable(daoClass = DownloadInfoDaoImpl.class)
public class DownloadInfo implements Serializable {
	
	private static final long serialVersionUID = 7874823823497497357L;
	
	/** 数据库自增主键 */
    @DatabaseField(generatedId = true)
    private int id;

    /** 用户ID */
    @DatabaseField(columnName = "user_id")
    private String userId;
    
    /** 书籍ID */
    @DatabaseField(columnName = "book_id")
    private String bookId;

    /** 下载地址  */
    @DatabaseField(columnName = "file_url")
    private String fileUrl;
    
    /** 下载起始点 */
    @DatabaseField(columnName = "pos_start")
    private int posStart=0;
    
    /** 下载结束点 */
    @DatabaseField(columnName = "pos_end")
    private int posEnd=0;
    
    /** 已下载字节数 */
    @DatabaseField(columnName = "down_length")
    private int downLength=0;
    
    /** 记录类型（1为文件信息，0为线程信息） */
    @DatabaseField(columnName = "record_type")
    private int recordType=0;
    
    /** 下载完成状态（recordType=1时对应DownloadStatus，recordType=0时1为已下载完成0为未下载完成）  */
    @DatabaseField(columnName = "download_status")
    private int downloadStatus=0;
    
    /** 下载百分比  */
    @DatabaseField(columnName = "download_percent")
    private float downloadPercent=0;
    
    public DownloadInfo() {
    	
    }
    
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
	
    public String getBookId() {
        return bookId;
    }

    public void setBookId(String bookId) {
        this.bookId = bookId;
    }
    
    public String getFileUrl() {
        return fileUrl;
    }

    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }
    
    public int getPosStart() {
        return posStart;
    }

    public void setPosStart(int posStart) {
        this.posStart = posStart;
    }
    
    public int getPosEnd() {
        return posEnd;
    }

    public void setPosEnd(int posEnd) {
        this.posEnd = posEnd;
    }
    
    public int getDownLength() {
        return downLength;
    }

    public void setDownLength(int downLength) {
        this.downLength = downLength;
    }
    
    public int getRecordType() {
        return recordType;
    }

    public void setRecordType(int recordType) {
        this.recordType = recordType;
    }
    
    public int getDownloadStatus() {
        return downloadStatus;
    }

    public void setDownloadStatus(int downloadStatus) {
        this.downloadStatus = downloadStatus;
    }
    
    public float getDownloadPercent() {
        return downloadPercent;
    }

    public void setDownloadPercent(float downloadPercent) {
        this.downloadPercent = downloadPercent;
    }
    
    public String toString() {
    	return "id:"+getId()
				+","+"user_id:"+getUserId()
				+","+"book_id:"+getBookId()
				+","+"pos_start:"+getPosStart()
				+","+"pos_end:"+getPosEnd()
				+","+"down_length:"+getDownLength()
				+","+"record_type:"+getRecordType()
				+","+"download_status:"+getDownloadStatus()
				+","+"download_percent:"+getDownloadPercent()
				+","+"file_url:"+getFileUrl()
				;
    }
}
